home *** CD-ROM | disk | FTP | other *** search
/ Macintosh Technology Seed 1996 September / Macintosh Technology Seed (September 1996) (CDRM1437020).ISO / pc / qd3d15d6 / 15d6_sdk.exe / QD3D Win32 1.5d6 / Interfaces / QD3DLight.h < prev    next >
C/C++ Source or Header  |  1996-08-21  |  10KB  |  323 lines

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DLight.h                                                  **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Generic light routines                                      **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1991-1996 Apple Computer, Inc. All rights reserved.     **    
  11.  **                                                                          **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DLight_h
  15. #define QD3DLight_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #if defined(THINK_C) || defined(__SC__)
  22.     #pragma options(!pack_enums, !align_arrays)
  23.     #pragma SC options align=power
  24. #elif defined(__MWERKS__)
  25.     #pragma enumsalwaysint on
  26.     #pragma align_array_members off
  27.     #pragma options align=native
  28. #elif defined(__PPCC__)
  29.     #pragma options align=power
  30. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  31.     #pragma options enum=int
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif    /* __cplusplus */
  37.  
  38. /******************************************************************************
  39.  **                                                                             **
  40.  **                            Enum Definitions                                 **
  41.  **                                                                             **
  42.  *****************************************************************************/
  43.  
  44. typedef enum TQ3AttenuationType {
  45.     kQ3AttenuationTypeNone,
  46.     kQ3AttenuationTypeInverseDistance,
  47.     kQ3AttenuationTypeInverseDistanceSquared
  48. } TQ3AttenuationType;
  49.  
  50.  
  51. typedef enum TQ3FallOffType {
  52.     kQ3FallOffTypeNone,
  53.     kQ3FallOffTypeLinear,
  54.     kQ3FallOffTypeExponential,
  55.     kQ3FallOffTypeCosine
  56. } TQ3FallOffType;
  57.  
  58.  
  59. /******************************************************************************
  60.  **                                                                             **
  61.  **                            Data Structure Definitions                         **
  62.  **                                                                             **
  63.  *****************************************************************************/
  64.  
  65. typedef struct TQ3LightData {
  66.     TQ3Boolean            isOn;
  67.     float                brightness;
  68.     TQ3ColorRGB            color;
  69. } TQ3LightData;
  70.  
  71. typedef struct TQ3DirectionalLightData {
  72.     TQ3LightData        lightData;
  73.     TQ3Boolean            castsShadows;
  74.     TQ3Vector3D            direction;
  75. } TQ3DirectionalLightData;
  76.  
  77. typedef struct TQ3PointLightData {
  78.     TQ3LightData        lightData;
  79.     TQ3Boolean            castsShadows;
  80.     TQ3AttenuationType    attenuation;
  81.     TQ3Point3D            location;
  82. } TQ3PointLightData;
  83.  
  84. typedef struct TQ3SpotLightData {
  85.     TQ3LightData        lightData;
  86.     TQ3Boolean            castsShadows;
  87.     TQ3AttenuationType    attenuation;
  88.     TQ3Point3D            location;
  89.     TQ3Vector3D            direction;
  90.     float                hotAngle;
  91.     float                outerAngle;
  92.     TQ3FallOffType        fallOff;
  93. } TQ3SpotLightData;
  94.  
  95.  
  96. /******************************************************************************
  97.  **                                                                             **
  98.  **                    Light routines (apply to all TQ3LightObjects)             **
  99.  **                                                                             **
  100.  *****************************************************************************/
  101.  
  102. QD3D_EXPORT TQ3ObjectType Q3Light_GetType(
  103.     TQ3LightObject        light);
  104.  
  105. QD3D_EXPORT TQ3Status Q3Light_GetState(
  106.     TQ3LightObject        light,
  107.     TQ3Boolean            *isOn);
  108.                 
  109. QD3D_EXPORT TQ3Status Q3Light_GetBrightness(
  110.     TQ3LightObject        light,
  111.     float                *brightness);
  112.     
  113. QD3D_EXPORT TQ3Status Q3Light_GetColor(
  114.     TQ3LightObject        light,
  115.     TQ3ColorRGB            *color);
  116.     
  117. QD3D_EXPORT TQ3Status Q3Light_SetState(
  118.     TQ3LightObject        light,
  119.     TQ3Boolean            isOn);
  120.                 
  121. QD3D_EXPORT TQ3Status Q3Light_SetBrightness(
  122.     TQ3LightObject        light,
  123.     float                brightness);
  124.     
  125. QD3D_EXPORT TQ3Status Q3Light_SetColor(
  126.     TQ3LightObject        light,
  127.     const TQ3ColorRGB    *color);
  128.  
  129. QD3D_EXPORT TQ3Status Q3Light_GetData(
  130.     TQ3LightObject        light,
  131.     TQ3LightData        *lightData);
  132.  
  133. QD3D_EXPORT TQ3Status Q3Light_SetData(
  134.     TQ3LightObject        light,
  135.     const TQ3LightData    *lightData);
  136.     
  137.  
  138. /******************************************************************************
  139.  **                                                                             **
  140.  **                            Specific Light Routines                               **
  141.  **                                                                             **
  142.  *****************************************************************************/
  143.  
  144. /******************************************************************************
  145.  **                                                                             **
  146.  **                            Ambient Light                                       **
  147.  **                                                                             **
  148.  *****************************************************************************/
  149.  
  150. QD3D_EXPORT TQ3LightObject Q3AmbientLight_New(
  151.     const TQ3LightData                *lightData);
  152.  
  153. QD3D_EXPORT TQ3Status Q3AmbientLight_GetData(
  154.     TQ3LightObject                    light,
  155.     TQ3LightData                    *lightData);
  156.  
  157. QD3D_EXPORT TQ3Status Q3AmbientLight_SetData(
  158.     TQ3LightObject                    light,
  159.     const TQ3LightData                *lightData);
  160.  
  161.  
  162. /******************************************************************************
  163.  **                                                                             **
  164.  **                        Directional Light                                     **
  165.  **                                                                             **
  166.  *****************************************************************************/
  167.  
  168. QD3D_EXPORT TQ3LightObject Q3DirectionalLight_New(
  169.     const TQ3DirectionalLightData    *directionalLightData);
  170.     
  171. QD3D_EXPORT TQ3Status Q3DirectionalLight_GetCastShadowsState(
  172.     TQ3LightObject                    light,
  173.     TQ3Boolean                        *castsShadows);
  174.     
  175. QD3D_EXPORT TQ3Status Q3DirectionalLight_GetDirection(
  176.     TQ3LightObject                    light,
  177.     TQ3Vector3D                        *direction);
  178.     
  179. QD3D_EXPORT TQ3Status Q3DirectionalLight_SetCastShadowsState(
  180.     TQ3LightObject                    light,
  181.     TQ3Boolean                        castsShadows);
  182.     
  183. QD3D_EXPORT TQ3Status Q3DirectionalLight_SetDirection(
  184.     TQ3LightObject                    light,
  185.     const TQ3Vector3D                *direction);
  186.  
  187. QD3D_EXPORT TQ3Status Q3DirectionalLight_GetData(
  188.     TQ3LightObject                    light,
  189.     TQ3DirectionalLightData            *directionalLightData);
  190.  
  191. QD3D_EXPORT TQ3Status Q3DirectionalLight_SetData(
  192.     TQ3LightObject                    light,
  193.     const TQ3DirectionalLightData    *directionalLightData);
  194.  
  195.  
  196. /******************************************************************************
  197.  **                                                                             **
  198.  **                        Point Light                                              **
  199.  **                                                                             **
  200.  *****************************************************************************/
  201.  
  202. QD3D_EXPORT TQ3LightObject Q3PointLight_New(
  203.     const TQ3PointLightData            *pointLightData);
  204.  
  205. QD3D_EXPORT TQ3Status Q3PointLight_GetCastShadowsState(
  206.     TQ3LightObject                    light,
  207.     TQ3Boolean                        *castsShadows);
  208.     
  209. QD3D_EXPORT TQ3Status Q3PointLight_GetAttenuation(
  210.     TQ3LightObject                    light,
  211.     TQ3AttenuationType                *attenuation);
  212.     
  213. QD3D_EXPORT TQ3Status Q3PointLight_GetLocation(
  214.     TQ3LightObject                    light,
  215.     TQ3Point3D                        *location);
  216.  
  217. QD3D_EXPORT TQ3Status Q3PointLight_GetData(
  218.     TQ3LightObject                    light,
  219.     TQ3PointLightData                *pointLightData);
  220.     
  221. QD3D_EXPORT TQ3Status Q3PointLight_SetCastShadowsState(
  222.     TQ3LightObject                    light,
  223.     TQ3Boolean                        castsShadows);
  224.     
  225. QD3D_EXPORT TQ3Status Q3PointLight_SetAttenuation(
  226.     TQ3LightObject                    light,
  227.     TQ3AttenuationType                attenuation);
  228.     
  229. QD3D_EXPORT TQ3Status Q3PointLight_SetLocation(
  230.     TQ3LightObject                    light,
  231.     const TQ3Point3D                *location);
  232.  
  233. QD3D_EXPORT TQ3Status Q3PointLight_SetData(
  234.     TQ3LightObject                    light,
  235.     const TQ3PointLightData            *pointLightData);
  236.     
  237.  
  238. /******************************************************************************
  239.  **                                                                             **
  240.  **                        Spot Light                                              **
  241.  **                                                                             **
  242.  *****************************************************************************/
  243.  
  244. QD3D_EXPORT TQ3LightObject Q3SpotLight_New(
  245.     const TQ3SpotLightData            *spotLightData);
  246.  
  247. QD3D_EXPORT TQ3Status Q3SpotLight_GetCastShadowsState(
  248.     TQ3LightObject                    light,
  249.     TQ3Boolean                        *castsShadows);
  250.     
  251. QD3D_EXPORT TQ3Status Q3SpotLight_GetAttenuation(
  252.     TQ3LightObject                    light,
  253.     TQ3AttenuationType                *attenuation);
  254.     
  255. QD3D_EXPORT TQ3Status Q3SpotLight_GetLocation(
  256.     TQ3LightObject                    light,
  257.     TQ3Point3D                        *location);
  258.         
  259. QD3D_EXPORT TQ3Status Q3SpotLight_GetDirection(
  260.     TQ3LightObject                    light,
  261.     TQ3Vector3D                        *direction);
  262.         
  263. QD3D_EXPORT TQ3Status Q3SpotLight_GetHotAngle(
  264.     TQ3LightObject                    light,
  265.     float                            *hotAngle);
  266.         
  267. QD3D_EXPORT TQ3Status Q3SpotLight_GetOuterAngle(
  268.     TQ3LightObject                    light,
  269.     float                            *outerAngle);
  270.         
  271. QD3D_EXPORT TQ3Status Q3SpotLight_GetFallOff(
  272.     TQ3LightObject                    light,
  273.     TQ3FallOffType                    *fallOff);
  274.  
  275. QD3D_EXPORT TQ3Status Q3SpotLight_GetData(
  276.     TQ3LightObject                    light,
  277.     TQ3SpotLightData                *spotLightData);
  278.  
  279. QD3D_EXPORT TQ3Status Q3SpotLight_SetCastShadowsState(
  280.     TQ3LightObject                    light,
  281.     TQ3Boolean                        castsShadows);
  282.     
  283. QD3D_EXPORT TQ3Status Q3SpotLight_SetAttenuation(
  284.     TQ3LightObject                    light,
  285.     TQ3AttenuationType                attenuation);
  286.     
  287. QD3D_EXPORT TQ3Status Q3SpotLight_SetLocation(
  288.     TQ3LightObject                    light,
  289.     const TQ3Point3D                *location);
  290.  
  291. QD3D_EXPORT TQ3Status Q3SpotLight_SetDirection(
  292.     TQ3LightObject                    light,
  293.     const TQ3Vector3D                *direction);
  294.  
  295. QD3D_EXPORT TQ3Status Q3SpotLight_SetHotAngle(
  296.     TQ3LightObject                    light,
  297.     float                            hotAngle);
  298.         
  299. QD3D_EXPORT TQ3Status Q3SpotLight_SetOuterAngle(
  300.     TQ3LightObject                    light,
  301.     float                            outerAngle);
  302.         
  303. QD3D_EXPORT TQ3Status Q3SpotLight_SetFallOff(
  304.     TQ3LightObject                    light,
  305.     TQ3FallOffType                    fallOff);
  306.  
  307. QD3D_EXPORT TQ3Status Q3SpotLight_SetData(
  308.     TQ3LightObject                    light,
  309.     const TQ3SpotLightData            *spotLightData);
  310.  
  311.  
  312. #ifdef __cplusplus
  313. }
  314. #endif    /* __cplusplus */
  315.  
  316. #if defined(__MWERKS__)
  317.     #pragma enumsalwaysint reset
  318. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  319.     #pragma options enum=reset
  320. #endif
  321.  
  322. #endif  /*  QD3DLight_h  */
  323.